home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / Field.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  5.5 KB  |  195 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.FilterInputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import symjava.lang.Bignum;
  9. import symjava.sql.Date;
  10. import symjava.sql.SQLException;
  11. import symjava.sql.Time;
  12. import symjava.sql.Timestamp;
  13.  
  14. public abstract class Field extends ServerObject {
  15.    int _type;
  16.    int _id;
  17.    boolean _null;
  18.  
  19.    int getBaseType() {
  20.       return 57;
  21.    }
  22.  
  23.    int getType() {
  24.       return 1;
  25.    }
  26.  
  27.    void read(DataInputStream in) throws SQLException, IOException, ErrorException {
  28.       in.readShort();
  29.       this._id = ((FilterInputStream)in).read();
  30.       this._type = in.readShort();
  31.       this._null = in.readByte() != 0;
  32.    }
  33.  
  34.    void write(DataOutputStream out) throws IOException {
  35.       out.writeByte(this.getType());
  36.       out.writeShort(3);
  37.       out.writeByte(this._id);
  38.       out.writeShort(this._type);
  39.       byte b = (byte)(!this._null ? 0 : 1);
  40.       out.writeByte(b);
  41.    }
  42.  
  43.    boolean storesData() {
  44.       return true;
  45.    }
  46.  
  47.    public boolean isNull() throws SQLException {
  48.       return this._null;
  49.    }
  50.  
  51.    public String getString() throws SQLException {
  52.       throw new SQLException("Can't convert data to requested format");
  53.    }
  54.  
  55.    public boolean getBoolean() throws SQLException {
  56.       throw new SQLException("Can't convert data to requested format");
  57.    }
  58.  
  59.    public byte getByte() throws SQLException {
  60.       throw new SQLException("Can't convert data to requested format");
  61.    }
  62.  
  63.    public short getShort() throws SQLException {
  64.       throw new SQLException("Can't convert data to requested format");
  65.    }
  66.  
  67.    public int getInt() throws SQLException {
  68.       throw new SQLException("Can't convert data to requested format");
  69.    }
  70.  
  71.    public long getLong() throws SQLException {
  72.       throw new SQLException("Can't convert data to requested format");
  73.    }
  74.  
  75.    public float getFloat() throws SQLException {
  76.       throw new SQLException("Can't convert data to requested format");
  77.    }
  78.  
  79.    public double getDouble() throws SQLException {
  80.       throw new SQLException("Can't convert data to requested format");
  81.    }
  82.  
  83.    public Bignum getBignum(int scale) throws SQLException {
  84.       throw new SQLException("Can't convert data to requested format");
  85.    }
  86.  
  87.    public byte[] getBytes() throws SQLException {
  88.       throw new SQLException("Can't convert data to requested format");
  89.    }
  90.  
  91.    public Date getDate() throws SQLException {
  92.       throw new SQLException("Can't convert data to requested format");
  93.    }
  94.  
  95.    public Time getTime() throws SQLException {
  96.       throw new SQLException("Can't convert data to requested format");
  97.    }
  98.  
  99.    public Timestamp getTimestamp() throws SQLException {
  100.       throw new SQLException("Can't convert data to requested format");
  101.    }
  102.  
  103.    public InputStream getAsciiStream() throws SQLException {
  104.       throw new SQLException("Can't convert data to requested format");
  105.    }
  106.  
  107.    public InputStream getUnicodeStream() throws SQLException {
  108.       throw new SQLException("Can't convert data to requested format");
  109.    }
  110.  
  111.    public InputStream getBinaryStream() throws SQLException {
  112.       throw new SQLException("Can't convert data to requested format");
  113.    }
  114.  
  115.    public void setNull(int sqlType) throws SQLException {
  116.       this._null = true;
  117.    }
  118.  
  119.    public void setBoolean(boolean x) throws SQLException {
  120.       throw new SQLException("Can't convert data to requested format");
  121.    }
  122.  
  123.    public void setByte(byte x) throws SQLException {
  124.       throw new SQLException("Can't convert data to requested format");
  125.    }
  126.  
  127.    public void setShort(short x) throws SQLException {
  128.       throw new SQLException("Can't convert data to requested format");
  129.    }
  130.  
  131.    public void setInt(int x) throws SQLException {
  132.       throw new SQLException("Can't convert data to requested format");
  133.    }
  134.  
  135.    public void setLong(long x) throws SQLException {
  136.       throw new SQLException("Can't convert data to requested format");
  137.    }
  138.  
  139.    public void setFloat(float x) throws SQLException {
  140.       throw new SQLException("Can't convert data to requested format");
  141.    }
  142.  
  143.    public void setDouble(double x) throws SQLException {
  144.       throw new SQLException("Can't convert data to requested format");
  145.    }
  146.  
  147.    public void setBignum(Bignum x) throws SQLException {
  148.       throw new SQLException("Can't convert data to requested format");
  149.    }
  150.  
  151.    public void setString(String x) throws SQLException {
  152.       throw new SQLException("Can't convert data to requested format");
  153.    }
  154.  
  155.    public void setBytes(byte[] x) throws SQLException {
  156.       throw new SQLException("Can't convert data to requested format");
  157.    }
  158.  
  159.    public void setDate(Date x) throws SQLException {
  160.       throw new SQLException("Can't convert data to requested format");
  161.    }
  162.  
  163.    public void setTime(Time x) throws SQLException {
  164.       throw new SQLException("Can't convert data to requested format");
  165.    }
  166.  
  167.    public void setTimestamp(Timestamp x) throws SQLException {
  168.       throw new SQLException("Can't convert data to requested format");
  169.    }
  170.  
  171.    public void setAsciiStream(InputStream x, int length) throws SQLException {
  172.       throw new SQLException("Can't convert data to requested format");
  173.    }
  174.  
  175.    public void setUnicodeStream(InputStream x, int length) throws SQLException {
  176.       throw new SQLException("Can't convert data to requested format");
  177.    }
  178.  
  179.    public void setBinaryStream(InputStream x, int length) throws SQLException {
  180.       throw new SQLException("Can't convert data to requested format");
  181.    }
  182.  
  183.    public int getSQLType() {
  184.       return 1111;
  185.    }
  186.  
  187.    public Object getObject() throws SQLException {
  188.       throw new SQLException("Can't convert data to requested format");
  189.    }
  190.  
  191.    public void setObject(Object obj) throws SQLException {
  192.       throw new SQLException("Can't convert data to requested format");
  193.    }
  194. }
  195.